<template>
	<view class="main">
		<view style="height: 80rpx;width: 100%;" ></view>
		<view class="user-header dis-row">
			<view class="header-ico"  @click="backNav"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/back.svg"></image></view>
			<view class="header-title">工分</view>
		</view>
		<!--图文-->
		<view class="header-adv v-box dis-row poser">
			<view class="adv-lst dis-clm">
				<view class="left-text">可用工分</view>
				<view class="left-item dis-row">
					<view class="item-title">{{listRow.count?listRow.count:0}}</view>
					<view class="item-src dis-row" @click="ponitNav">
						<label>记录</label>
						<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/rightJt.png"></image></label>
					</view>
				</view>
			</view>
			<view class="adv-right">
				<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/gf-adv.png"></image>
			</view>
		</view>
		<!--2-->
		<view class="v-smain">
			<view class="smain-item v-box">
				<view class="first-title dis-row">
					<view class="firest-ico"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/gongico.png"></image></view>
					<view class="firest-text">做任务赚工分</view>
				</view>
				<view class="sec-title dis-row">
					<view class="poser" v-for="(item,index) in lstmenu" :key="index" :class="{'checkActive':index == current}"
					 @click="changeClick(index)">{{item.name}}<label v-if="index==current"></label></view>
				</view>
				<!--lst-->
				<view class="lst-item poser" @click="isRealNameClick">
					<view class="item-dec dis-clm">
						<view class="dec-ps dis-row"><label>实名认证</label><text>+4工分</text></view>
						<view class="dec-tx">完成实名认证</view>
					</view>
					<view class="goRenzheng">{{listRow.isrealname==0?'去认证':'已认证'}}</view>
				</view>
				
				<view class="lst-item poser" @click="iscompanyClick">
					<view class="item-dec dis-clm">
						<view class="dec-ps dis-row"><label>企业认证</label><text>+20工分</text></view>
						<view class="dec-tx">完成企业认证</view>
					</view>
					<view class="goRenzheng">{{listRow.iscomname==0?'去认证':'已认证'}}</view>
				</view>
				
				<view class="lst-item poser" @click="isWanshanZiliao">
					<view class="item-dec dis-clm">
						<view class="dec-ps dis-row"><label>完善资料</label><text>+2工分</text></view>
						<view class="dec-tx">完善个人资料</view>
					</view>
					<view class="goRenzheng">{{listRow.iswanshan==0?'去完善':'已完善'}}</view>
				</view>
				
				<view class="lst-item poser" @click="isProject">
					<view class="item-dec dis-clm">
						<view class="dec-ps dis-row"><label>完善项目经历</label><text>+1工分</text></view>
						<view class="dec-tx">完善个人资料中项目资料</view>
					</view>
					<view class="goRenzheng">{{listRow.ispro==0?'去完善':'已完善'}}</view>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
import Index from "@/common/index-model.js"
let index = new Index();
let that = null;
export default {
	data() {
		return {
			lstmenu:[
				{name:'完善资料',value:0},
				{name:'成就奖励',value:1}
			],
			current:0,
			listRow:{
				count:0, //可用公分
				lst:[], //记录
				isrealname:0,//是否实名认证
				iscomname:0, //是否企业认证
				iswanshan:0, //是否完善资料
				ispro:0 //是否完善项目经历
			}
			
		}
	},
	onLoad() {
		this.getClicent()
	},
	onPullDownRefresh() {
		this.getClicent()
		setTimeout(function () {
			uni.stopPullDownRefresh();
		}, 1000);
	},
	methods: {
		ponitNav() {
			index.navigate_to('./PointsRecord')
		},
		changeClick(sn) {
			this.current = sn
		},
		backNav() {
			index.navigate_back(1)
		},
		getClicent() {
			index.getPublicUserMember({},'client/individual/work/points','get',res=>{
				if(res.data.code == 200 && res.data.success){
					this.listRow.count = res.data.result.workPont
					this.listRow.isrealname = res.data.result.isRealName?res.data.result.isRealName:0
					this.listRow.iscomname = res.data.result.isEnterprise?res.data.result.isEnterprise:0
					this.listRow.iswanshan = res.data.result.isInfoAll?res.data.result.isInfoAll:0
					this.listRow.ispro = res.data.result.hasWorkHis?res.data.result.hasWorkHis:0
				}
			})
		},
		//实名认证
		isRealNameClick() {
			if(this.listRow.isrealname && this.listRow.isrealname == 1){
				index.show_tips('你已经做过实名认证了')
				return false
			}else{
				index.navigate_to('./RealName')
			}
		},
		//企业认证
		iscompanyClick() {
			if(this.listRow.iscomname && this.listRow.iscomname == 1){
				index.show_tips('你已经做过企业认证了')
				return false
			}else{
				index.navigate_to('./EnterpriseCertification')
			}
		},
		//完善个人资料
		isWanshanZiliao() {
			if(this.listRow.iswanshan && this.listRow.iswanshan == 1){
				index.show_tips('你已经做过完善资料')
				return false
			}else{
				index.navigate_to('./MyEditUserInfo')
			}
		},
		//完善项目资料
		isProject() {
			let url='./Mybusinesscard'
			if(this.listRow.ispro && this.listRow.ispro==1){
				index.show_tips('你已经完善过项目经历')
				return false
			}else{
				index.navigate_to(url)
			}
		}
	}
}	
</script>

<style>
@import url("@/static/css/publics.css");	
@import url("@/static/css/getCentimeter.css");
</style>